package stool.visitor;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author Felix YF Dong
 * @Date 2021/5/16
 */
public class ObjectStructure {

    private List<Person> persons = new ArrayList<>();

    public void attach(Person person) {

        persons.add(person);
    }

    public void detach(Person person) {

        persons.remove(person);
    }

    public void find(Action action) {

        persons.forEach(person -> person.accept(action));
    }
}
